package git12;

public class Decrypt {
    public String Decrypt(String dec){
//将字符串反转转为字符数组
        String dec1=dec;
        StringBuilder sb=new StringBuilder(dec1).reverse();
        char[] arr3 = sb.toString().toCharArray();

//实现字符数组首尾交换
        char temp= arr3[0];
        arr3[0]=arr3[arr3.length-1];
        arr3[arr3.length-1]=temp;

//实现字符数组的减法运算
        char []arr4=new char[arr3.length];
        for (int k = 0; k < arr3.length; k++) {
            arr4[k]= (char) (arr3[k]-1-k-3);
        }
//转为字符串输出
        String dec2=new String(arr4);
        return dec2;
    }
}
